package com.wenan.ui.controls.listpanel
{
	import flash.display.DisplayObject;
	
	import mx.core.FlexGlobals;
	import mx.managers.PopUpManager;
	import mx.managers.SystemManager;

	public class PopupModellocator
	{
		private static var _instance:PopupModellocator;
		private static var popupArray:Array;
		
		public function PopupModellocator()
		{
			if(_instance)
				throw new Error("单列");
		}
		
		public static function getInstance():PopupModellocator
		{
			if(_instance==null)
			{
				_instance=new PopupModellocator();
				popupArray=new Array();
			}
			return _instance;
		}
		
		public function show(control:*,parent:DisplayObject):void{
			if(popupArray.length>0)
				PopUpManager.removePopUp(control);
			else
			{
				popupArray.push(control);
				PopUpManager.addPopUp(control,parent);
			}
		}
		
		public function hide():void
		{
			PopUpManager.removePopUp(popupArray[0]);
		}
	}
}